package com.brsya.movie.fragment;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.widget.RelativeLayout;

import androidx.fragment.app.FragmentTransaction;

import com.brsya.base.base.BaseLayoutFragment;
import com.brsya.movie.R;
import com.bytedance.sdk.dp.DPSdk;
import com.bytedance.sdk.dp.DPWidgetNewsParams;
import com.bytedance.sdk.dp.IDPNewsListener;
import com.bytedance.sdk.dp.IDPWidget;

/**
 * Created by Brsya
 * CreateDate: 2022/7/25  18:33
 * Description:
 * 新闻
 */
public class NewsFragment extends BaseLayoutFragment {


    private RelativeLayout rlNewsBox;


    public static NewsFragment newInstance() {

        Bundle args = new Bundle();

        NewsFragment fragment = new NewsFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected void initView() {
        setContentViewId(R.layout.fragment_news);
        rlNewsBox = findViewById(R.id.rl_news_box);
    }

    @Override
    protected void initData() {
        if (DPSdk.factory()  == null) {
            return;
        }
        IDPWidget newsTabs = DPSdk.factory().createNewsOneTab(DPWidgetNewsParams.obtain().setDisableLuckView(false).listener(new IDPNewsListener() {}));
        FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
        fragmentTransaction.add(R.id.rl_news_box, newsTabs.getFragment());
        fragmentTransaction.commit();
    }
}
